<div class="widget editor-widget">
	<div class="widget-header bg-blue">
		<i class="widget-icon icon-notebook"></i> 
		<span class="widget-caption"> 客户资料 </span>
		<div class="widget-buttons">
			<a href="javascript:void(0);" onclick="handlerCancel(this);" title="关闭"
				 data-toggle="dispose" data-refresh-table="#table-customer"> <i class="fa fa-times"></i> </a> 
		</div>
	</div>
	<div class="widget-body">
		<!-- TODO 跟进记录 -->
		<!-- TODO 跟进记录 -->
		<div class="widget radius-bordered mgbt-xs-10 " id="editor-panel-selling">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> 
				<span class="widget-caption"> <a href="" data-toggle="collapse"> 跟进记录 </a> </span>
				<div class="widget-buttons compact">
					<a href="" data-toggle="collapse"> <i class="fa fa-compress"></i> </a> 
				</div>
			</div>
			<div class="widget-body editor-body-sm">
				<form class="table-editor table-editor-selling">
					<table data-ajax="handlerSearch" data-method="post" data-toggle="table"
								 data-id-field="id" 
								 data-unique-id="id" 
								 data-pagination="true"  
								 data-check-on-init="true" 
								 data-side-pagination="server" 
								 data-mobile-responsive="true"
								 data-form-source=".table-editor-selling"
								 data-form-target="#editor-form-selling"
								 data-form-search="#search-form-selling" id="table-selling">
						<thead>
							<tr>
								<th data-field="id" data-visible="false"></th>
								<th data-field="createDate" data-align="center">通话时间</th>
								<th data-field="intention" 	data-align="center" data-formatter="renderIntention">意向程度</th>
								<th data-field="content" 		data-align="center">跟踪情况</th>
								<th data-field="nextDate" 	data-align="center">下次沟通时间</th>
								<th data-field="username" 	data-align="center">顾问</th>
								<th data-field="userid" 		data-align="center" data-visible="false">顾问ID</th>
							</tr>
						</thead>
					</table>
				</form>
			</div>
		</div>
		
		<!-- TODO 诺访记录 -->
		<div class="widget radius-bordered mgbt-xs-10 " id="editor-panel-bespoke">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> 
				<span class="widget-caption"> <a href="" data-toggle="collapse"> 诺访记录 </a> </span>
				<div class="widget-buttons compact">
					<a href="" data-toggle="collapse"> <i class="fa fa-compress"></i> </a> 
				</div>
			</div>
			<div class="widget-body editor-body-sm">
				<form class="table-editor table-editor-bespoke">
					<table data-ajax="handlerSearch" data-method="post" data-toggle="table"
								 data-id-field="id" 
								 data-unique-id="id" 
								 data-pagination="true"  
								 data-check-on-init="true" 
								 data-side-pagination="server" 
								 data-mobile-responsive="true"
								 data-form-source=".table-editor-bespoke"
								 data-form-target="#editor-form-bespoke"
								 data-form-search="#search-form-bespoke" id="table-bespoke">
						<thead>
							<tr>
								<th data-field="id" data-visible="false"></th>
								<th data-field="createDate" 	data-align="center">预约时间</th>
								<th data-field="bespokeType" 	data-align="center" data-formatter="renderAuditions">预约内容</th>
								<th data-field="promiseDate" 	data-align="center">诺访时间</th>
								<th data-field="commingDate" 	data-align="center" data-formatter="renderCommings">到店情况</th>
								<th data-field="username" 		data-align="center">顾问</th>
								<th data-field="userid" 			data-align="center" data-visible="false">顾问ID</th>
							</tr>
						</thead>
					</table>
				</form>
			</div>
		</div>
		
				<!-- TODO 基本信息 -->
		<div class="widget radius-bordered mgbt-xs-10">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> 
				<span class="widget-caption"> 基本信息 </span>
			</div>
			<div class="widget-body editor-body-sm editor-body-customer">
				<!-- dynamic data -->
			</div>
		</div>
		
		<!-- TODO 家长信息 -->
		<div class="widget radius-bordered mgbt-xs-10">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> 
				<span class="widget-caption"> <a href="" data-toggle="collapse"> 家长信息 </a> </span>
				<div class="widget-buttons compact">
					<a href="" data-toggle="collapse"> <i class="fa fa-compress"></i> </a> 
				</div>
			</div>
			<div class="widget-body editor-body-sm editor-body-parents">
				<!-- dynamic data -->
			</div>
		</div>
		
		<!-- TODO 宝宝信息 -->
		<div class="widget radius-bordered mgbt-xs-10 ">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> 
				<span class="widget-caption"> <a href="" data-toggle="collapse"> 宝宝信息 </a> </span>
				<div class="widget-buttons compact">
					<a href="" data-toggle="collapse"> <i class="fa fa-compress"></i> </a> 
				</div>
			</div>
			<div class="widget-body editor-body-sm editor-body-student">
				<!-- dynamic data -->
			</div>
		</div>
		
	</div>
</div>
				
<!-- 查询表单 ========================================================= -->
<form id="search-form-parents" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.esm.entity.customer.Parents" 
			data-template-target=".editor-body-parents" data-template-id="#lost-parents-template" 
			data-template-path="/miwawa/content/esm/customer/template.html">
			<input type="hidden" name="invalid" value="F" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="customerId" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" data-search-sort="status" data-search-order="desc">
</form>
<form id="search-form-student" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.esm.entity.customer.Student" 
			data-template-target=".editor-body-student" data-template-id="#lost-student-template" 
			data-template-path="/miwawa/content/esm/customer/template.html">
			<input type="hidden" name="status" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="invalid" value="F" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="customerId" value="0" data-search-group="and" data-search-operation="EQ">
</form>
<form id="search-form-selling" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.esm.entity.customer.Selling">
			<input type="hidden" name="status" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="invalid" value="F" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="customerId" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" data-search-sort="createDate" data-search-order="desc">
</form>
<form id="search-form-bespoke" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.esm.entity.view.AuditionView">
			<input type="hidden" name="customerId" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" data-search-sort="createDate" data-search-order="desc">
</form>
    
<script type="text/javascript">
<!--
	require(['domReady'],function(domReady){
		domReady(function () {
			initData();
		});
	});
	
	var customer;
	function initData(){
		customer = jQuery("#table-customer").data("selectedRow");
		
		jQuery(":hidden[name='customerId'],[data-foreign-id]").val(customer.customerid);
		
		require(['moment','jquery.plugin.form'],function(moment,form){
			form.datepicker(".date-selector");
			form.tooltip("[data-toggle='tooltip']");
		});
		
		jQuery(".editor-body-customer").loadform("load", {
			templateId: "#lost-customer-template",
			templatePath: "/miwawa/content/portal/customer/template.html",
			templateData: customer
		});
		
 		jQuery("#search-form-parents").loadform("many"); 
		
 		jQuery("#search-form-student").loadform("many");

		jQuery("[data-toggle='table']").bootstrapTable();
	}
	
	// 渲染列表试听列
	function renderAuditions(value, row, index){
		if(value == "试听" && row.classes){
			return value+" "+row.classes;
		}else{
			return value;			
		}
	}
	
	// 渲染列表到访列
	function renderCommings(value, row, index){
		if(row.id == "edit"){
			return ""
		}else{
			if(row.commingState == "" ){
				return "";			
			}else if(row.commingState == "1"){
				return "未到店";			
			}else if(row.commingState == "0"||row.commingState == "2"){
				return "已到店";			
			}else{
				return "";
			}
		}
	}
//-->
</script>